/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ventasInternet.utils;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

/**
 *
 * @author DESARO03
 */
public class ManejadorMensajes {

    public static void showMessageInfo(String detail) {
        showMessageInfo(null, detail);
    }

    public static void showMessageError(String detail) {
        showMessageError(null, detail);
    }
    
    public static void showMessageInfo(String clientId, String detail) {
        FacesContext context = FacesContext.getCurrentInstance();
        FacesMessage msgInfo = new FacesMessage(FacesMessage.SEVERITY_INFO, "Información", detail);
        context.addMessage(clientId, msgInfo);
    }
    
    public static void showMessageInfo(String clientId, String summary, String detail) {
        FacesContext context = FacesContext.getCurrentInstance();
        FacesMessage msgInfo = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, detail);
        context.addMessage(clientId, msgInfo);
    }
    
    public static void showMessageError(String clientId, String detail) {
        FacesContext context = FacesContext.getCurrentInstance();
        FacesMessage msgError = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", detail);
        context.addMessage(clientId, msgError);
    }
    
    public static void showMessageError(String clientId, String summary, String detail) {
        FacesContext context = FacesContext.getCurrentInstance();
        FacesMessage msgError = new FacesMessage(FacesMessage.SEVERITY_ERROR, summary, detail);
        context.addMessage(clientId, msgError);
    }
    
    public static void showMessageWarning(String clientId, String detail) {
        FacesContext context = FacesContext.getCurrentInstance();
        FacesMessage msgWarning = new FacesMessage(FacesMessage.SEVERITY_WARN, "Advertencia", detail);
        context.addMessage(clientId, msgWarning);
    }
    
    public void msgGrabarNuevo(){
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
                "Información", "Registro grabado con Exito!"));
    }
    
    public void msgGrabarModificacion(){
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
                "Información", "Registro modificado con Exito!"));
    }
    
    public void msgInactivacion(){
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
                "Información", "Registro inactivado con Exito!"));
    }
    
    public void msgYaInactivado(){
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
                "Información", "Registro ya esta Inactivo!"));
    }
    
    public static void msgYaAsociado(String mensaje){
         FacesContext context = FacesContext.getCurrentInstance();  
         context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_FATAL,"Error", mensaje  ));
    }
    
    public static void msgAsociadoExito(String mensaje){
         FacesContext context = FacesContext.getCurrentInstance();  
         context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,"Exito", mensaje  ));
    }
    
    public static void msgDesaSociadoExito(String mensaje){
         FacesContext context = FacesContext.getCurrentInstance();  
         context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,"Informacion", mensaje  ));
    }
  
    public static void showMessageFormulaIncorreca(String msg) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, 
                new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error! "+msg, msg));
    }
    
    public static void showMessageFormulaCorreca(String msg) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, 
                new FacesMessage(FacesMessage.SEVERITY_INFO, "Exito!", msg));
    }
    
    public static void showMessageGuardadoExito(String msg) {
        FacesContext context = FacesContext.getCurrentInstance();
        context.addMessage(null, 
                new FacesMessage(FacesMessage.SEVERITY_INFO, "Exito!", msg));
    }
}
